package Models::db::Menu;

#use lib 'd:/test_project/lib/';
use strict;
use DBI; 
  

	sub trim
	{
		my $string = shift;
		$string =~ s/^\s+//;
		$string =~ s/\s+$//;
		return $string;
	}
	
	sub new {
		my $check = shift;
		my $arr = shift; 
		my $class = ref($check) || $check;
		my $self = {status => 1};
		if ($arr) {
			$self->{Columns} = {
				id 			=> $$arr{id},
				active 			=> $$arr{active},
				content_id  		=> $$arr{fk_content_id},
				name 			=> trim($$arr{name}),
				position	 	=> $$arr{position},
				code  			=> trim($$arr{code}),
			};
		} else {
			$self->{Columns} = {
				id 			=> undef,
				active 			=> undef,
				content_id  		=> undef,
				name 			=> undef,
				position	 	=> undef,
				code  			=> undef,
			};
		}
		return bless($self, $class);
	}
	
	sub getContent {
		my $self = shift;
		return $self->{Columns};	
	}
  
	sub getId {
		my $self = shift;
		return $self->{Columns}{id};	
	}
  
	sub getActive {
		my $self = shift;
		return $self->{Columns}{active};	
	}
  
	sub getContentId {
		my $self = shift;
		return $self->{Columns}{content_id};	
	}
  
	sub getName {
		my $self = shift;
		return $self->{Columns}{name};	
	}
	
	sub getPosition {
		my $self = shift;
		return $self->{Columns}{position};	
	}
	  
	sub getCode {
		my $self = shift;
		return $self->{Columns}{code};	
	}

1;